package com.pro.controller;

import com.pro.pojo.JsMenu;
import com.pro.pojo.JsonData;
import com.pro.service.JsMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * ClassName:JsMenuController
 * Package:com.pro.controller
 * Description: 导航栏controller
 *
 * @Date:2022/1/7 上午 9:44
 * @Author: WYH
 */
@RestController
@RequestMapping("/menu")
public class JsMenuController {

    @Autowired
    private JsMenuService jsMenuService;

    /**
     * @author WYH
     * @date 2022/1/11 下午 2:45
     * @content : 查询导航栏数据
     */
    @RequestMapping("/getMenu")
    public JsonData getMenu(Integer userId, Integer parentId) {
        List<JsMenu> menu = jsMenuService.getMenu(userId, parentId);
        return menu != null ? JsonData.buildSuccess(menu) : JsonData.buildError("数据异常");
    }



    /**
     * @author WYH
     * @date 2022/1/11 下午 2:45
     * @content : 计算广告过期的数量
     */
    @RequestMapping("/expireCount")
    public JsonData expireCount(){
        Integer expireCount = jsMenuService.expireCount();
        return expireCount>=0? JsonData.buildSuccess(expireCount): JsonData.buildError("服务端错误");
    }


    /**
     * @Author WYH
     * @Description //TODO 课程待审核数量
     * @Date 上午 11:42 2022/2/15
     * @Param courseCstatus
     * @return  JsonData
     **/
    @RequestMapping("/courseCstatusCount")
    public JsonData courseCstatusCount(String courseCstatus){
        Integer integer = jsMenuService.courseCstatusCount(courseCstatus);
        System.err.println(integer);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }

    /**
     * @Author WYH
     * @Description //TODO 商品待审核
     * @Date 上午 11:52 2022/2/15
     * @Param result,type
     * @return  JsonData
     **/
    @RequestMapping("/resultCount")
    public JsonData resultCount(String result,String type){
        Integer integer = jsMenuService.resultCount(result,type);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }

    /**
     * @Author WYH
     * @Description //TODO 微圈待审核
     * @Date 上午 11:52 2022/2/15
     * @Param type,aduitLogType
     * @return JsonData
     **/
    @RequestMapping("/aduitLogTypeCount")
    public JsonData aduitLogTypeCount(String type, String aduitLogType){
        Integer integer = jsMenuService.aduitLogTypeCount(type, aduitLogType);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }

    /**
     * @Author WYH
     * @Description //TODO 创作者审核
     * @Date 上午 11:52 2022/2/15
     * @Param result
     * @return JsonData
     **/
    @RequestMapping("/jsApplyRecordCount")
    public JsonData jsApplyRecordCount(String result){
        Integer integer = jsMenuService.jsApplyRecordCount(result);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }

    /**
     * @Author WYH
     * @Description //TODO 订单退订
     * @Date 上午 11:53 2022/2/15
     * @Param orderStatus
     * @return JsonData
     **/
    @RequestMapping("/UnsubscribeCount")
    public JsonData UnsubscribeCount(String orderStatus){
        Integer integer = jsMenuService.UnsubscribeCount(orderStatus);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }

    //教师↓
    /**
     * @Author WYH
     * @Description //TODO 通过审核课程
     * @Date 上午 8:55 2022/2/16
     * @Param courseCstatus
     * @return JsonData
     **/
    @RequestMapping("/CourseApprovedCount")
    public JsonData CourseApprovedCountInteger(String courseCstatus){
        Integer integer = jsMenuService.CourseApprovedCountInteger(courseCstatus);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }
    /**
     * @Author WYH
     * @Description //TODO 待付款课程订单
     * @Date 上午 9:08 2022/2/16
     * @Param orderStatus,orderType
     * @return JsonData
     **/
    @RequestMapping("/statusCount")
    public JsonData statusCount(String orderStatus,String orderType){
        Integer statusCount = jsMenuService.statusCount(orderStatus,orderType);
        return statusCount>=0? JsonData.buildSuccess(statusCount): JsonData.buildError("数据异常");
    }

    //运营↓
    /**
     * @Author WYH
     * @Description //TODO 通过审核商品
     * @Date 上午 10:41 2022/2/16
     * @Param result，type
     * @return  JsonData
     **/
    @RequestMapping("/GoodsApprovedCount")
    public JsonData GoodsApprovedCount(String result,String type){
        Integer integer = jsMenuService.GoodsApprovedCount(result,type);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }
    /**
     * @Author WYH
     * @Description //TODO 查询未评论个数
     * @Date 上午 9:13 2022/2/10
     * @Param comment,orderType
     * @return JsonData
     **/
    @RequestMapping("/commentCount")
    public JsonData commentCount(String comment,String orderType){
        Integer integer = jsMenuService.commentCount(comment,orderType);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }

    //人事↓
    /**
     * @Author WYH
     * @Description //TODO
     * @Date 下午 1:25 2022/2/16
     * @Param position
     * @return  Integer
     **/
    @RequestMapping("/positionCount")
    public JsonData positionCount(String position){
        Integer integer = jsMenuService.positionCount(position);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }
    /**
     * @Author WYH
     * @Description //TODO 用户封停到期
     * @Date 下午 2:02 2022/2/16
     * @Param type
     * @return  Integer
     **/
    @RequestMapping("/shutDownCount")
    public JsonData shutDownCount(String type){
        Integer integer = jsMenuService.shutDownCount(type);
        return integer>=0? JsonData.buildSuccess(integer): JsonData.buildError("服务端错误");
    }
}
